# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=ktimetracker
pkgver=5.0.1
pkgrel=5
# armhf blocked by extra-cmake-modules
arch="all !armhf"
url="https://apps.kde.org/ktimetracker/"
pkgdesc="Todo management and time tracker"
license="GPL-2.0-or-later AND GFDL-1.2-only"
makedepends="
	extra-cmake-modules
	kcalendarcore5-dev
	kconfig5-dev
	kconfigwidgets5-dev
	kdbusaddons5-dev
	kdoctools5-dev
	ki18n5-dev
	kidletime5-dev
	kio5-dev
	kjobwidgets5-dev
	knotifications5-dev
	ktextwidgets5-dev
	kwindowsystem5-dev
	kxmlgui5-dev
	qt5-qtbase-dev
	samurai
	"
checkdepends="xvfb-run"
source="https://download.kde.org/stable/ktimetracker/$pkgver/src/ktimetracker-$pkgver.tar.xz
	Fix-formatTime.patch
	"
subpackages="$pkgname-doc $pkgname-lang"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	case "$CARCH" in
		armv7|x86) excluded_tests="(exportcsv|task)test" ;;
		*) excluded_tests="" ;;
	esac

	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest -E "($excluded_tests)"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="78de8651efd72fa9fd5c7f06992ab8970e1d763c6f30f5eba52ec93bb6a2bb19ae777bc90809ef5198bc3b6a5f9f5ee78e240eadcacd8ce8489bdb28cd62431e  ktimetracker-5.0.1.tar.xz
17e72f13e896c9b90ad6ee8eff607afabc14eac6f5a2be6e81e91f0fb63eda02a4064b5e66fef9ddcd09cfd84a910b5ff6603f5d191f64eb9ce98024e403aace  Fix-formatTime.patch"
